﻿@model MasResourceGroup

@{
    var resType = new KPIS.GERP.WEB.GIMS.MasResourceService.MasResourceServiceClient().
        SelectResourceType(new MasResourceType{ResTypeId = ViewBag.ResTypeId}, null).FirstOrDefault();
    ViewBag.CustomMenu = new Dictionary<string, string>
        {
            {
                "ประเภท" + resType.Name, Url.Action("Index", "MasResourceType")
            },
            {
                "หมวด" , Url.Action("Index", "MasResourceGroup", new {resTypeId= resType.ResTypeId})
            }
        };
    ViewBag.ResType = resType;
    ViewBag.Title = "เพิ่มหมวดพัสดุ";
    ViewBag.Descr = "เพิ่มข้อมูลหมวดพัสดุในระบบ";
}

@using (Html.BeginForm("Create", "MasResourceGroup", FormMethod.Post, new { @class = "form-horizontal", ViewBag.ResTypeId }))
{
     @Html.AntiForgeryToken() 

    <div class="block-button-menu-above">
        @Html.ButtonViewAll(new {resTypeId= resType.ResTypeId})
        @Html.ButtonSubmit()
    </div>
    
    @Html.Partial("_EditorForm")
    @Html.ValidationSummary(true, ValidateText.RequiredField, new { @class = "alert alert-error" })

}

@section scripts
{
    <script>
        $("form").not("#formsearch").submit(function (e) {
            e.preventDefault();
            var currentForm = this;
            bootbox.confirm("ท่านต้องการยืนยัน ใช่หรือไม่", function(result) {
                if (result) {
                    currentForm.submit();
                }
            }); 
        });
    </script>
}